<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>创建店铺</title>
    <include file="public/header_m_notitle"/>
    <!--内容列表-->
    <form action="__URL__/createPost" method="post" enctype="multipart/form-data">
        <input name="name" id="name" placeholder="店铺名称" class="dc-input"/>
        <div class="am-form-group text-center mar-10">
            <foreach name="infos" item="t">
            <label class="am-checkbox-inline">
                <input type="checkbox" name="type[]" value="{$t.id}"> {$t.name}
            </label>
            </foreach>
        </div>
        <input name="location" id="location" placeholder="地址" class="dc-input"/>
        <input name="shop_tel" id="shop_tel" placeholder="店铺电话" class="dc-input"/>
        <input name="open_time" id="open_time" placeholder="营业时间" class="dc-input"/>
        <hr class="dc-hr2"/>
        <div class="am-form-group am-form-file dc-div-1">
            <button type="button" class="am-btn am-btn-default am-btn-sm">
                <i class="am-icon-cloud-upload"></i> 上传店铺照片
            </button>
            <input id="doc-form-file" type="file" name="file" multiple>
        </div>
        <div id="file-list" class="dc-div-1"></div>
        <div class="dc-div-1">
            <textarea name="intro" id="intro" rows="5" class="dc-text-area" placeholder="店铺介绍"></textarea>
        </div>
        <div class="dc-div-1">
        <input type="submit" id="submit" class="am-btn am-btn-success" value="提交" style="width: 90%;">
        </div>
    </form>
    <!--end-->

    <include file="public/footer_m_nojs"/>
    <script src="__PUBLIC__/assets/js/jquery.min.js"></script>
    <script src="__PUBLIC__/assets/js/amazeui.min.js"></script>
    <script>
        $(function () {
            $('#doc-form-file').on('change', function () {
                var fileNames = '';
                $.each(this.files, function () {
                    fileNames += '<span class="am-badge">' + this.name + '</span> ';
                });
                $('#file-list').html(fileNames);
            });
            $('#submit').on('click',function(){
                if($('#name').val() ==''){
                    alert('你还没有填写名称');
                    $('#name').focus();
                    return false;
                }
                if($('#location').val() ==''){
                    alert('你还没有填写地址');
                    $('#location').focus();
                    return false;
                }
                if($('#shop_tel').val() ==''){
                    alert('你还没有填写电话');
                    $('#shop_tel').focus();
                    return false;
                }
                if($('#per_price').val() ==''){
                    alert('你还没有填写人均价格');
                    $('#per_price').focus();
                    return false;
                }
                if($('#open_time').val() ==''){
                    alert('你还没有填写营业时间');
                    $('#open_time').focus();
                    return false;
                }
                if($('#doc-form-file').val() ==''){
                    alert('你还没有上传文件');
                    return false;
                }
                if($('#intro').val() ==''){
                    alert('你还没有填写介绍');
                    $('#intro').focus();
                    return false;
                }
            });
        });
    </script>
    </body>
</html>